/* GUI CONVERTED from rerpex.p (converter v1.76) Mon May 27 10:17:29 2002 */
/* rerpex.p - EXPLODE REPETITIVE SCHED INTO WO'S W/COMPONENTS AND ROUTINGS  */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                      */
/* All rights reserved worldwide.  This is an unpublished work.             */
/* $Revision: 1.9.2.4 $                                                     */
/*V8:ConvertMode=Report                                                     */
/* REVISION: 5.0       LAST MODIFIED: 04/07/89      BY: EMB                 */
/* REVISION: 5.0       LAST MODIFIED: 05/23/89      BY: EMB                 */
/* REVISION: 5.0       LAST MODIFIED: 06/23/89      BY: MLB *B159* (b)      */
/* REVISION: 6.0       LAST MODIFIED: 07/06/90      BY: EMB *D040*          */
/* REVISION: 6.0       LAST MODIFIED: 09/24/90      BY: SMM *D072*          */
/* REVISION: 6.0       LAST MODIFIED: 11/20/90      BY: emb *D223*          */
/* REVISION: 6.0       LAST MODIFIED: 03/26/91      BY: emb *D456*          */
/* REVISION: 6.0       LAST MODIFIED: 09/09/91      BY: emb *D855*          */
/* REVISION: 6.0       LAST MODIFIED: 12/03/91      BY: emb *D955*          */
/* REVISION: 7.0       LAST MODIFIED: 10/11/91      BY: emb *F024*          */
/* REVISION: 7.0       LAST MODIFIED: 10/08/91      BY: pma *F003*          */
/* REVISION: 7.0       LAST MODIFIED: 03/01/92      BY: smm *F230*          */
/* REVISION: 7.0       LAST MODIFIED: 03/23/92      BY: pma *F089*          */
/* REVISION: 7.0       LAST MODIFIED: 05/05/92      BY: emb *F469*          */
/* REVISION: 7.0       LAST MODIFIED: 05/22/92      BY: emb *F521*          */
/* REVISION: 7.0       LAST MODIFIED: 09/03/92      BY: emb *F892*          */
/* REVISION: 7.0       LAST MODIFIED: 10/12/92      BY: emb *G071*          */
/* REVISION: 7.3       LAST MODIFIED: 10/29/92      BY: jcd *G250*          */
/* REVISION: 7.3       LAST MODIFIED: 11/30/92      BY: emb *G365*          */
/* REVISION: 7.2       LAST MODIFIED: 12/21/92      BY: emb *G466*          */
/* REVISION: 7.3       LAST MODIFIED: 01/13/93      BY: emb *G689*          */
/* REVISION: 7.3       LAST MODIFIED: 02/23/93      BY: emb *G760*          */
/* REVISION: 7.3       LAST MODIFIED: 10/19/93      BY: pxd *GG41*          */
/* REVISION: 7.3       LAST MODIFIED: 02/25/94      BY: pma *FM46*          */
/* REVISION: 7.3       LAST MODIFIED: 10/31/94      BY: WUG *GN76*          */
/* REVISION: 8.5       LAST MODIFIED: 01/03/95      BY: mwd *J034*          */
/* REVISION: 8.5       LAST MODIFIED: 06/16/95      BY: RMH *J04R*          */
/* REVISION: 8.5       LAST MODIFIED: 09/05/95      BY: srk *J07G*          */
/* REVISION: 7.3       LAST MODIFIED: 12/13/95      BY: jym *G1G6*          */
/* REVISION: 7.4       LAST MODIFIED: 02/13/96      BY: jym *G1N4*          */
/* REVISION: 8.5       LAST MODIFIED: 06/20/96      BY: taf *J0VG*          */
/* REVISION: 8.6E      LAST MODIFIED: 02/23/98      BY: *L007* A. Rahane        */
/* REVISION: 8.6E      LAST MODIFIED: 04/01/98      BY: *J23R* Santhosh Nair    */
/* REVISION: 8.6E      LAST MODIFIED: 10/04/98      BY: *J314* Alfred Tan       */
/* REVISION: 9.1       LAST MODIFIED: 03/24/00      BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1       LAST MODIFIED: 08/12/00      BY: *N0KP* myb              */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.9.2.4 $    BY: Katie Hilbert      DATE: 05/15/02  ECO: *P06H*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "2+ "}

define new shared buffer gl_ctrl for gl_ctrl.
define new shared variable comp        like ps_comp.
define new shared variable wo_recno    as recid.
define new shared variable prev_status like wo_status.
define new shared variable prev_qty    like wo_qty_ord.

define new shared variable site        like ptp_site.

define buffer rpsmstr for rps_mstr.

define new shared variable rps_start   like rps_due_date.
define new shared variable rpsduedate  like rps_due_date.
define new shared variable rpsduedate1 like rps_due_date.
define new shared variable site1       like rps_site.
define new shared variable site2       like rps_site.
define new shared variable part        like rps_part.
define new shared variable part1       like rps_part.
define new shared variable prline      like rps_line.
define new shared variable prline1     like rps_line.
define new shared variable last_site   like rps_site.
define new shared variable last_line   like rps_line.
define new shared variable last_part   like rps_part.

for first mfc_ctrl
   fields(mfc_field mfc_logical)
   where mfc_field = "rpc_using_new" no-lock:
end. /* for first mfc_ctrl */

if available mfc_ctrl and mfc_logical = true then do:
   {pxmsg.i &MSGNUM=5122 &ERRORLEVEL=3}
   message.
   message.
   undo, leave.
end.

for first rpc_ctrl
   fields(rpc_sch_bck rpc_wk_start) no-lock:
end. /* for first rpc_ctrl */

if available rpc_ctrl then do:
   rps_start = today.
   if rpc_wk_start < 8 then do:
      if rpc_wk_start = 0 then rps_start = rps_start - rpc_sch_bck.
      else do:
         if weekday(today) >= rpc_wk_start
         then
            rps_start = rps_start - weekday(rps_start) + rpc_wk_start.
         else
            rps_start = rps_start - weekday(rps_start) + rpc_wk_start - 7.
      end.
   end.
end.
rpsduedate = rps_start.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
part       colon 20 part1          colon 45 label {t001.i}
   site1      colon 20 site2          colon 45 label {t001.i}
   prline     colon 20 prline1        colon 45 label {t001.i}
   rpsduedate colon 20 rpsduedate1    colon 45 label {t001.i}
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

mainloop:
repeat:

   if rpsduedate1 = hi_date  then rpsduedate1 = ?.
   if rpsduedate  = low_date then rpsduedate  = ?.
   if part1       = hi_char  then part1       = "".
   if site2       = hi_char  then site2       = "".
   if prline1     = hi_char  then prline1     = "".

   update
      part part1
      site1 site2
      prline prline1
      rpsduedate rpsduedate1
   with frame a.

   bcdparm = "".

   {gprun.i ""gpquote.p"" "(input-output bcdparm,8,
        part,
        part1,
        site1,
        site2,
        prline,
        prline1,
        string(rpsduedate),
        string(rpsduedate1),
        null_char,null_char,null_char,
        null_char,null_char,
        null_char,null_char,null_char,
        null_char,null_char,
        null_char,null_char)"}

   /*THESE NEED TO STAY HERE BELOW THE BATCH QUOTING*/
   if rpsduedate1 = ?  then rpsduedate1 = hi_date.
   if rpsduedate  = ?  then rpsduedate  = low_date.
   if part1       = "" then part1       = hi_char.
   if site2       = "" then site2       = hi_char.
   if prline1     = "" then prline1     = hi_char.

   if not batchrun then do:
      {gprun.i ""gpsirvr.p""
         "(input site1, input site2, output return_int)"}
      if return_int = 0 then do:
         next-prompt site1 with frame a.
         undo mainloop, retry mainloop.
      end.
   end.

   assign
      comp      = ""
      last_site = ?
      last_line = ?
      last_part = ?.

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "printer"
               &printWidth = 132
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "yes"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.


   {mfphead.i}

   {gprun.i ""rerpexc.p""}

   {mfrtrail.i}
end.
